import time

# 方法1
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.remote.switch_to import SwitchTo

# 引入action chains
from selenium.webdriver.common.action_chains import ActionChains

wd = webdriver.Chrome(service=Service(".\chromedriver_win136.exe"))

# wd.get("https://demo.automationtesting.in/Slider.html")
wd.get("http://127.0.0.1:5000/elements/")

time.sleep(3)
# ele = wd.find_element(By.CSS_SELECTOR, "#slider")
ele = wd.find_element(By.CSS_SELECTOR, "#volumeSlider")
time.sleep(3)
ac = ActionChains(wd)
for i in range(10):
    ac.drag_and_drop_by_offset(ele, 5 * i, 0).perform()
    print(i)
    time.sleep(3)
# ac.drag_and_drop_by_offset(ele, 10, 0).perform()
time.sleep(10)
